<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
|==========================================================
| Code Igniter - by pMachine
|----------------------------------------------------------
| www.codeignitor.com
|----------------------------------------------------------
| Copyright (c) 2006, pMachine, Inc.
|----------------------------------------------------------
| This library is licensed under an open source agreement:
| www.codeignitor.com/docs/license.html
|----------------------------------------------------------
| File: helpers/ip_helper.php
|----------------------------------------------------------
| JAVASCRIPT HELPER
|==========================================================
*/


   /**
    * Normalize a string => lowercase, remove accents, spaces and invalid chars
    * used to produce filename and links
    * @param   string  $rawtag
    * @return  string  normalize string
    */
    function normalizeStr($rawStr)
    {
        $accent     = utf8_decode(" .ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ");
        $noaccent   = utf8_decode("__aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby");
        $normStr    = strtr(trim(html_entity_decode(utf8_decode($rawStr), ENT_NOQUOTES)), $accent, $noaccent);
        $validChars = 'a-zA-Z0-9-_';
        $normStr    = preg_replace("/[^$validChars]/", "", $normStr);
        return strtolower($normStr);
    }

    /**
    * Beautifier to reverse the normalize function (see above)
    * capitalize and remove underscores
    * @param   string  $normStr
    * @return  string  transformed string
    */
    function unNormalizeStr($normStr)
    {
      return ucfirst(str_replace('_', ' ', $normStr));
    }


?>
